package com.ruoyi.school.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.school.mapper.HomeWorkMapper;
import com.ruoyi.school.domain.HomeWork;
import com.ruoyi.school.service.IHomeWorkService;

/**
 * 学生作品Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-08-31
 */
@Service
public class HomeWorkServiceImpl implements IHomeWorkService 
{
    @Autowired
    private HomeWorkMapper homeWorkMapper;

    /**
     * 查询学生作品
     * 
     * @param imageId 学生作品主键
     * @return 学生作品
     */
    @Override
    public HomeWork selectHomeWorkByImageId(Integer imageId)
    {
        return homeWorkMapper.selectHomeWorkByImageId(imageId);
    }

    /**
     * 查询学生作品列表
     * 
     * @param homeWork 学生作品
     * @return 学生作品
     */
    @Override
    public List<HomeWork> selectHomeWorkList(HomeWork homeWork)
    {
        return homeWorkMapper.selectHomeWorkList(homeWork);
    }

    /**
     * 新增学生作品
     * 
     * @param homeWork 学生作品
     * @return 结果
     */
    @Override
    public int insertHomeWork(HomeWork homeWork)
    {
        homeWork.setCreateTime(DateUtils.getNowDate());
        return homeWorkMapper.insertHomeWork(homeWork);
    }

    /**
     * 修改学生作品
     * 
     * @param homeWork 学生作品
     * @return 结果
     */
    @Override
    public int updateHomeWork(HomeWork homeWork)
    {
        homeWork.setUpdateTime(DateUtils.getNowDate());
        return homeWorkMapper.updateHomeWork(homeWork);
    }

    /**
     * 批量删除学生作品
     * 
     * @param imageIds 需要删除的学生作品主键
     * @return 结果
     */
    @Override
    public int deleteHomeWorkByImageIds(Integer[] imageIds)
    {
        return homeWorkMapper.deleteHomeWorkByImageIds(imageIds);
    }

    /**
     * 删除学生作品信息
     * 
     * @param imageId 学生作品主键
     * @return 结果
     */
    @Override
    public int deleteHomeWorkByImageId(Integer imageId)
    {
        return homeWorkMapper.deleteHomeWorkByImageId(imageId);
    }
}
